﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="consultaNovedad.aspx.cs" Inherits="WebContratos.consultaNovedad" %>

<%@ Register TagPrefix="cc1" Namespace="BunnyBear" Assembly="msgBox" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Página sin título</title>
    
    <link rel="stylesheet" type="text/css" media="all" href="css/calendario/themeBlue.css" title="Aqua"/>
	<link rel="alternate stylesheet" type="text/css" media="all" href="css/calendario/theme(1)Blue.css" title="Tiger"/>
	
	<script type="text/javascript" src="js/calendario/calendar.js"></script>
	<script type="text/javascript" src="js/calendario/calendar-en.js"></script>
	<script type="text/javascript" src="js/deluxe/dpopupwindow.js"></script>
	<script type="text/javascript" src="js/deluxe/deluxe-popup-window.js"></script>
	
	<script type="text/javascript">
		
		var oldLink = null;
		
		function setActiveStyleSheet(link, title) 
		{
		  var i, a, main;
		  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			  a.disabled = true;
			  if(a.getAttribute("title") == title) a.disabled = false;
			}
		  }
		  if (oldLink) oldLink.style.fontWeight = 'normal';
		  oldLink = link;
		  link.style.fontWeight = 'bold';
		  return false;
	    }

		function selected(cal, date) {
			  cal.sel.value = date; // just update the date in the input field.
			  if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
				// if we add this call we close the calendar on single-click.
				// just to exemplify both cases, we are using this only for the 1st
				// and the 3rd field, while 2nd and 4th will still require double-click.
				cal.callCloseHandler();
		}

		function closeHandler(cal) {
			  cal.hide();                        // hide the calendar
			//  cal.destroy();
			  _dynarch_popupCalendar = null;
		}
            
        
        function showCalendarControl(id, idImage, format, showsTime, showsOtherMonths) 
        {
			  var el = dg.GetEditFormElement('dg1',id);
			  var idIma = dg.GetEditFormElement('dg1',idImage);

			  if (_dynarch_popupCalendar != null) {
				// we already have some calendar created
				_dynarch_popupCalendar.hide();                 // so we hide it first.
			  } else {
				// first-time call, create the calendar.
				var cal = new Calendar(1, null, selected, closeHandler);
				// uncomment the following line to hide the week numbers
				// cal.weekNumbers = false;
				if (typeof showsTime == "string") {
				  cal.showsTime = true;
				  cal.time24 = (showsTime == "24");
				}
				if (showsOtherMonths) {
				  cal.showsOtherMonths = true;
				}
				_dynarch_popupCalendar = cal;                  // remember it in the global var
				cal.setRange(1900, 2070);        // min/max year allowed.
				cal.create();
			  }
			  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
			  
			 // alert(el);
			  
			  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
			  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

			  // the reference element that we pass to showAtElement is the button that
			  // triggers the calendar.  In this example we align the calendar bottom-right
			  // to the button.
			  _dynarch_popupCalendar.showAtElement(idIma, "Br");//(el.nextSibling, "Br");        // show the calendar

			  return false;
		}
            
			function showCalendar(id, idImage, format, showsTime, showsOtherMonths) {
			  var el = document.getElementById(id);
			  var idIma = document.getElementById(idImage);

			  if (_dynarch_popupCalendar != null) {
				// we already have some calendar created
				_dynarch_popupCalendar.hide();                 // so we hide it first.
			  } else {
				// first-time call, create the calendar.
				var cal = new Calendar(1, null, selected, closeHandler);
				// uncomment the following line to hide the week numbers
				// cal.weekNumbers = false;
				if (typeof showsTime == "string") {
				  cal.showsTime = true;
				  cal.time24 = (showsTime == "24");
				}
				if (showsOtherMonths) {
				  cal.showsOtherMonths = true;
				}
				_dynarch_popupCalendar = cal;                  // remember it in the global var
				cal.setRange(1900, 2070);        // min/max year allowed.
				cal.create();
			  }
			  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
			  
			 // alert(el);
			  
			  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
			  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

			  // the reference element that we pass to showAtElement is the button that
			  // triggers the calendar.  In this example we align the calendar bottom-right
			  // to the button.
			  _dynarch_popupCalendar.showAtElement(idIma, "Br");//(el.nextSibling, "Br");        // show the calendar

			  return false;
			}

			var MINUTE = 60 * 1000;
			var HOUR = 60 * MINUTE;
			var DAY = 24 * HOUR;
			var WEEK = 7 * DAY;

			// If this handler returns true then the "date" given as
			// parameter will be disabled.  In this example we enable
			// only days within a range of 10 days from the current
			// date.
			// You can use the functions date.getFullYear() -- returns the year
			// as 4 digit number, date.getMonth() -- returns the month as 0..11,
			// and date.getDate() -- returns the date of the month as 1..31, to
			// make heavy calculations here.  However, beware that this function
			// should be very fast, as it is called for each day in a month when
			// the calendar is (re)constructed.
			function isDisabled(date) {
			  var today = new Date();
			  return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
			}

			function flatSelected(cal, date) {
			  var el = document.getElementById("preview");
			  el.innerHTML = date;
			}

			function showFlatCalendar() {
			  var parent = document.getElementById("display");

			  // construct a calendar giving only the "selected" handler.
			  var cal = new Calendar(0, null, flatSelected);



			  // hide week numbers
			  cal.weekNumbers = false;

			  // We want some dates to be disabled; see function isDisabled above
			  cal.setDisabledHandler(isDisabled);
			  cal.setDateFormat("%A, %B %e");

			  // this call must be the last as it might use data initialized above; if
			  // we specify a parent, as opposite to the "showCalendar" function above,
			  // then we create a flat calendar -- not popup.  Hidden, though, but...
			  cal.create(parent);

			  // ... we can show it here.
			  cal.show();
			}
	
	</script>
	
    
     <LINK href= "css/owastyle.css" 
type=text/css rel=stylesheet>
<LINK href="css/owacolors.css" 
type=text/css rel=stylesheet>
<LINK id=cssFont 
href="css/style30.css" type=text/css rel=stylesheet>


    <style>
td.bar
{
height:			34px;
padding-left:	10px;
vertical-align: middle;
font-weight:	bold;
font-size:		14px;
color:			#ffffff;
overflow:		hidden;
text-overflow:	ellipsis;
}
table.stageContextBar
{
filter		: progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#6489d4,endColorStr=#466094);
background-image: -moz-linear-gradient(top, #FFFFFF, #C4DDFF);
background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #C4DDFF),color-stop(1, #FFFFFF));
border-bottom:1px solid #466094;
}
table.leftContextBar
{
filter		: progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#485673,endColorStr=#63769c);
background-image: -moz-linear-gradient(top, #FFFFFF, #C4DDFF);
background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #C4DDFF),color-stop(1, #FFFFFF));
border-bottom:1px solid #485674;
border-right:1px solid #466094;
}
#Dgradiente {
	background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #739AD5),color-stop(1, #FFFFFF));
	}

    </style>
    
    	  <link rel="stylesheet" href="css/estiloTablas.css" type="text/css"/>
    
    <style type="text/css">
                
                .cajaTexto
                {
                font-size:11px; font:Tahoma;
                border-left:#6699CC 1px solid; border-bottom:#4167B0 1px solid;
                border-right:#6699CC 1px solid; border-top:#4167B0 1px solid;  
                }

                #Dgradiente {

	                background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #CEDCF8),color-stop(1, #E5EEFC));
	                }
       
	         .btnCrm
	         { width:84px; height:22px; 
	           border-left:#6699CC thin solid; border-bottom:#4167B0 thin solid;
	           border-right:#6699CC thin solid; border-top:#4167B0 thin solid; 
	               font-size: 11px;
                background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #D0E5F7),color-stop(1, #B9D5EF));
            }
        	 
	         #button:active { 
	        position:relative; 
	        top:1px /* or more */ 
	        } 
            
            .Estilo3 {color: #000000; font-size: 11px; }
        
        </style>
        
      <script>
        function abrirPopup(c_campo1, c_campo2, valor)
		{
            
           
		  campo1 = document.getElementById(c_campo1).value;
		  campo2 = document.getElementById(c_campo2).value;
		 
		  nomCampo1 = c_campo1;		  
		  nomCampo2 = c_campo2;
		  
		  var longiBusc = 0;
		  var longiBusc1 = 0;
		  
		  if(valor==1)
		  {
		    obtieneListaValores(campo1, campo2, 'consultaAdministrador');			
		  }
		}
        
        var obj;
              function getXMLHTTPRequest() 
              {
                 var xRequest=null;
                if (window.XMLHttpRequest) {
                xRequest=new XMLHttpRequest();
                }else if (typeof ActiveXObject != "undefined"){
                  xRequest=new ActiveXObject("Microsoft.XMLHTTP");
                }
                  return xRequest;
                }
            function obtieneListaValores(campo1, campo2, campo3)
            {
                obj=getXMLHTTPRequest();
                if(obj!=null)
                {
                    obj.onreadystatechange = ProcessResponse;
                    obj.open("GET", "Srvlets/ProcessedPage.aspx?campo1="+campo1+"&campo2="+campo2+"&campo3="+campo3,  true);
                    obj.send(null);         
                }
                return false;
            }

            function ProcessResponse()
            {
                var basePath = "";
                
                if(obj.readyState == 4)
                {
                    if(obj.status == 200)
                    {
                        var retval=obj.responseText;  
                        
                        window.open(basePath+'General/encontrarDatos.aspx?exP='+navigator.appName.indexOf("Microsoft")+'&nomCampo1='+nomCampo1+'&nomCampo2='+nomCampo2,'Consulta','width=590px,height=300px');

                    }
                    else
                    {
                        alert("Error retrieving data!" );
                    }   
                }
            }
            
            function consuNovedad(codContrato)
            {
                try
                {
                    window.opener.consuNovedad(codContrato);
                    top.close();
                }
                catch(e)
                {
                    alert(e);
                }
            }

    </script>
    	  
</head>
<body>
    <form id="form1" runat="server">
    <table id="tblGarantia" cellpadding ="0" cellspacing ="6" style="width:100%" >
    <tr>
      <td style="width:25%">
    <asp:Label ID="lblSecuencia" runat="server" Text="Secuencia de Novedad:"></asp:Label>        
    </td>
      <td>
    <asp:TextBox ID="txtSecuencia" runat="server" CssClass="cajaTexto" ReadOnly="True"></asp:TextBox>
    </td>
    </tr>


<tr>
      <td>
    <asp:Label ID="lblFechaNovedad" runat="server" Text="Fecha de Novedad:"></asp:Label>        
    </td>
      <td>
    <asp:TextBox ID="txtFechaNovedad" runat="server" CssClass="cajaTexto"></asp:TextBox>
          <IMG style="cursor:pointer;"
            id="txttxtInciFecha02" border=0 alt="Calendario" width="16px" height="16px"
            src="images/calendar.png" onclick="return showCalendar(&#39;txtFechaNovedad&#39;,&#39;txttxtInciFecha02&#39;, &#39;%Y-%m-%d&#39;, &#39;24&#39;, true);">
            <span class="style6">YYYY-MM-DD</span></td>
    </tr>
    
    
    <tr>
      <td>
    <asp:Label ID="lblTipoNovedad" runat="server" Text="Tipo de Novedad:"></asp:Label>        
    </td>
      <td>
          <asp:DropDownList ID="txtTipoNovedad" runat="server" CssClass="cajaTexto" 
              DataSourceID="SqlDataSource1" DataTextField="CATALOGO_DESCRIPCION" 
              DataValueField="CATALOGO_CODIGO" Height="16px" Width="159px">
          </asp:DropDownList>
          <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
              ConnectionString="<%$ ConnectionStrings:ConnectionString3 %>" 
              ProviderName="<%$ ConnectionStrings:ConnectionString3.ProviderName %>" 
              
              
              
              SelectCommand="select * from web_Catalogo where catalogo_nombre = 'TIPNOVE' ">
          </asp:SqlDataSource>
    </td>
    </tr>
    
    

    
    
    <tr>
      <td>
    <asp:Label ID="lblNovedad" runat="server" Text="Novedad:"></asp:Label>        
    </td>
      <td rowspan="3">
    <asp:TextBox ID="txtNovedad" runat="server" CssClass="cajaTexto" Height="82px" 
              TextMode="MultiLine" Width="217px"></asp:TextBox>
      </td>
    </tr>
    
    <tr>
      <td>
          &nbsp;</td>
    </tr>
    
    <tr>
      <td>
          &nbsp;</td>
    </tr>
    
    
    
    
    
    <tr>
      <td>
          &nbsp;</td>
      <td>
          &nbsp;</td>
    </tr>
    
    
    
    
    
    <tr>
      <td>
          &nbsp;</td>
      <td>
          <asp:Button ID="btnGrabar" runat="server" CssClass="btnCrm" Text="Grabar" 
              onclick="btnGrabar_Click" />
          <input id="btnCancelar" class="btnCrm" type="button" onclick="javaScript:top.close();" value="Cancelar" /></td>
    </tr>
    
    
    
    <cc1:msgBox id="MsgBox1" style="Z-INDEX: 103; LEFT: 536px; POSITION: absolute; TOP: 184px" runat="server"></cc1:msgBox>
    
    </table>
    
    <script>
    
        obj=document.getElementById('txtTipoNovedad');
        var tipoGaran = '<%=unGaran.TipoNovedad%>';
        var valorEstContra = '';
        var valorEstContraText = '';

             for(var i= 0; i<obj.length; i++)
             {
                valorEstContra = obj.options[i].value;
                valorEstContraText = obj.options[i].text;
                if (valorEstContra == tipoGaran)
                {
                    //document.getElementById('lblPlazoContra').value = valorEstContraText;
                    document.getElementById('txtTipoNovedad').value = valorEstContra;
                }
             }
             
      
    
    </script>

    <asp:TextBox ID="txtCodContrato" Visible="false" runat="server"></asp:TextBox>
    <asp:Label ID="lblTipo" runat="server" Visible="False"></asp:Label>
    
    </form>
</body>
</html>
